package com.loongtech.bi.manager.ios;

import com.loongtech.bi.entity.ios.EntityMonthProductManager;
import com.loongtech.core.jpa.manager.ManagerQueryCacheBase;
import com.loongtech.core.util.Time;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class MonthProductManager extends ManagerQueryCacheBase<EntityMonthProductManager> {

	private static final long serialVersionUID = 2L;

	private static List<String[]> MarkList; // 所有标示名称

	public Map<String, String> getProductMap() {
		Map<String, String> productItmes = new HashMap<String, String>();
		MarkList = findByQuery("select distinct productid, name  from EntityProductManager");
		productItmes = new HashMap<String, String>();
		for (Object[] s : MarkList) {
			productItmes.put((String) s[0] + "-" + (String) s[1], (String) s[0]);
		}
		return productItmes;
	}

	public Map<String, String> getProjectMap() {
		Map<String, String> projectItmes = new HashMap<String, String>();
		// markMap = Utils.getProjectids(PROJECT_URL);
		projectItmes = new HashMap<String, String>();
		projectItmes.put("权力与荣耀国内", "1");
		return projectItmes;
	}

    public List<EntityMonthProductManager> getMonthProducts(Date dateStart) {
        return findByQuery("from EntityMonthProductManager where lookMonth>=:dayStart ", "dayStart", Time.getMonthStr(dateStart));
    }
}
